﻿<Window x:Class="Wpf2.Views.FormProductHidden"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Quản lý kho - Sản phẩm ẩn" Height="700" Width="Auto" WindowStartupLocation="CenterScreen" WindowState="Maximized">
    <StackPanel Orientation="Vertical" Background="#FF5C5CD6">
        <StackPanel Orientation="Horizontal" Margin="10,10,10,5"  Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
                <Label Content="Tìm theo mã sản phẩm:" Margin="0,10,0,0"/>
                <StackPanel Orientation="Horizontal">
                    <Grid Height="28">
                    <TextBox Name="txtIDPro" Text="" Background="#FF16499A"  FontSize="16" HorizontalAlignment="Left"  Height="25" Width="200" Margin="0,0,0,0" TextChanged="TxtIdProTextChanged" Foreground="#FFF6F6F6"/>
                        <ComboBox Name="cmbSearchByID" SelectionChanged="ComboBoxSelectionChanged" Visibility="Hidden"  IsTabStop="False" IsSynchronizedWithCurrentItem="True" ></ComboBox>
                    </Grid>
                <Button x:Name="btnSearchbyid" Width="40"  HorizontalAlignment="Left" Margin="0,10" Click="BtnSearchbyidClick" Background="#FF0050EF">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Wpf2;component/Images/searchicon.png" Width="20" Height="20"/>
                        </StackPanel>
                    </Button>
                </StackPanel>
                <Label Content="Tìm theo tên sản phẩm:" Margin="10,10,0,0" />
                <StackPanel Orientation="Horizontal">
                    <Grid Height="28">
                    <TextBox Name="txtSearchbyName" Background="#FF16499A"  Text="" FontSize="16" HorizontalAlignment="Left"  Height="25" Width="200" Margin="0,0,0,0" TextChanged="TxtSearchbyNameTextChanged" Foreground="#FFF6F6F6"/>
                        <ComboBox Name="cmbSearchByName"  Visibility="Hidden"  IsTabStop="False" IsSynchronizedWithCurrentItem="True" SelectionChanged="CmbSearchByNameSelectionChanged" ></ComboBox>
                    </Grid>
                <Button x:Name="btnSearchbyName" Width="40" HorizontalAlignment="Left" Margin="0,10" Click="BtnSearchbyNameClick" Background="#FF0050EF">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Wpf2;component/Images/searchicon.png" Width="20" Height="20"/>
                        </StackPanel>
                    </Button>
                </StackPanel>
            </StackPanel>
        <DataGrid Height="500" x:Name="dtgProduct" ItemsSource="{Binding}"  CanUserAddRows="True" AutoGenerateColumns="False"  AlternatingRowBackground="PaleTurquoise" LoadingRow="DtgProductLoadingRow" Margin="10,5,10,10" IsReadOnly="True">
            <DataGrid.RowHeaderTemplate >
                <DataTemplate>
                    <TextBlock  Width="20" Text="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}, Mode=FindAncestor}}"/>
                </DataTemplate>
            </DataGrid.RowHeaderTemplate>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Mã SP Auto" Width="50"  Binding="{Binding ProductIdAuto, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True" Visibility="Hidden"/>
                <DataGridTextColumn Header="Mã SP" Width="100"  Binding="{Binding ProductId, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Tên sản phẩm" Width="240" Binding="{Binding ProductName, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Mô tả" Width="270" Binding="{Binding ProductDescription, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="SL" Width="50" Binding="{Binding InventoryCount,UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Giá lẻ" Width="150" Binding="{Binding SellPrice,UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Giá sỉ" Width="150" Binding="{Binding CostPrice,UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Đơn vị" Width="150" Binding="{Binding UnitName, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTextColumn Header="Danh mục" Width="150" Binding="{Binding CatalogName, UpdateSourceTrigger=PropertyChanged}"/>
                <DataGridTemplateColumn>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button x:Name="btnAdd" Width="50" Background="{x:Null}" Click="BtnAddClick"  >
                                <StackPanel Orientation="Horizontal">
                                    <Image Source="/Wpf2;component/Images/visible.png" Width="20" Height="20"/>
                                    <TextBlock Text="Hiện" VerticalAlignment="Center" Margin="2,0,0,0"/>
                                </StackPanel>
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </StackPanel>
</Window>
